import org.apache.commons.lang.StringUtils;

import java.io.File;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName start
 * @Description T0D0
 * @Author ykq11
 * @Date 2024/2/20 22:23
 * @Version 1.0
 **/
public class start {
    public static void main(String[] args) {
        ConfigStrategy build = ConfigStrategy.build();
        // 定义初始延迟和循环周期（这里是15分钟）
        long initialDelay = 0;
        Long period = build.getLong("time");
        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        Runnable task = () -> {
            ReplaceKeywordInFile.defectOperator(".defect", build.getProperty("defectTargetPath"),
                    build.getProperty("defectMoveTargetPath"), build.getProperty("defectReplaceWork"), build.getProperty("defectKeywordToReplace"), true);
        };
        // 启动定时任务
        scheduler.scheduleAtFixedRate(task, initialDelay, period, TimeUnit.MINUTES);
    }
}
